#ifndef UI_ELEMENT_SLIDER_H__
#define UI_ELEMENT_SLIDER_H__
#include "ProjectHeader.h"
#include "UIElement.h"

enum sliderTypeEnum{clipFront, clipBack, stretch };

class UISliderElement : public UIElement
{
public:
	bool Draw(std::vector<vertex> * VBOVec, const std::map<int, texCoord2f>& texMap, GLuint currentTex);
	bool DrawForeground(std::vector<vertex> * VBOVec, const std::map<int, texCoord2f>& texMap, GLuint currentTex);
	bool DrawBackground(std::vector<vertex> * VBOVec, const std::map<int, texCoord2f>& texMap, GLuint currentTex);

	void SetSliderBackground(texCoord2f sliderBackgroundTexture);
	void SetSliderPosition(vertex2f btmLft);
	void SetSliderSize(vertex2f size);
	void SetSliderTexture(texCoord2f sliderTexture);
	void SetSliderMode( sliderTypeEnum sliderType, int min = 0, int max = 100);

private:

	bool DrawSliderSpecificBackgrounds(std::vector<vertex> * VBOVec, const std::map<int, texCoord2f>& texMap, GLuint currentTex);
	void SetSliderAreaRectangle(vertex2f Position);
	rectangle CalculateSliderBarAreaRectangle(float size);
	texCoord2f CalculateSliderBarTexture(float size);
	bool StatValueHasChanged();

	texCoord2f _sliderTexture;				//Holds the texture to be applied to the slider bar. It is either clipped or stretched, depending ont he slider mode.
	texCoord2f _sliderBackgroundTexture;	//Holds the texture for the background of the slider display; visible through alpha on the slider, or where it's not covered.

	sliderTypeEnum _sliderType;	//Holds the type of the slider; clipFront and clipBack don't stretch the texture, 
								//but instead cut it off at the front (high value end) or back (low value end) respectivly. stretch stretches the texture to the size of the bar.
	int _sliderMin;				//Holds the mininum value. Anything lower than this shows an empty bar.
	int _sliderMax;				//Holds the maximum value. Anything greater than this shows a full bar.
	
	rectangle _sliderArea;	//Holds all four corners of the slider
	vertex2f _sliderSize;	//Holds the size of this slide

};
#endif